﻿// (c) Copyright 2013 Mike Riedel.
// This source is subject to the Microsoft Public License (Ms-PL).
// All other rights reserved.

using System;
using FreshMeat.ErrorHandlingBlock;

namespace ErrorHandlingBlock.Tests
{
   public class FakeDetector : IErrorDetector
   {
      public Type RelevantType { get; set; }

      public Exception DesiredDiagnoseResult { get; set; }

      public bool IsRelevant(Exception error)
      {
         return error.GetType() == RelevantType;
      }

      public Exception Diagnose(Exception error)
      {
         return DesiredDiagnoseResult ?? error;
      }
   }
}